package cn.xinfei.xdecision.pulsar.config;

import org.apache.commons.lang3.StringUtils;

import static cn.xinfei.xdecision.pulsar.config.XDecisionMessage.MsgType.INSERT;

public class XDecisionMessage {
    private String key;
    private String msgId;
    private String data;
    private String type = INSERT.name();

    public String getKey() {
        if (StringUtils.isEmpty(key)) {
            return "default";
        }
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getMsgId() {
        return msgId;
    }

    public void setMsgId(String msgId) {
        this.msgId = msgId;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public static enum MsgType {
        INSERT, UPDATE, UPDATE_STATE, UPDATE_LOG
    }
}
